package de.cau.apo.samples;

import java.io.FileNotFoundException;
import java.io.IOException;

import de.cau.apo.CommunicationInterface;
import de.cau.apo.problems.identicalscheduling.ISInstance;
import de.cau.apo.problems.identicalscheduling.ISSolution;
import de.cau.apo.problems.identicalscheduling.Job;
import de.cau.apo.problems.identicalscheduling.Machine;

public class IdenticalSchedulingSample {

	public static void main(String[] args) throws FileNotFoundException, IOException {
		// create instance parse instance file
		ISInstance instance = new ISInstance();
		instance.parseInstance(CommunicationInterface.getInstance());
		// create solution by assigning every job to the first machine
		ISSolution solution = new ISSolution(instance);
		Machine machine = solution.getMachine(0);
		for (Job job : instance.getJobs()) {
			machine.addJob(job);
		}
		// publish solution and do debug information output
		if (CommunicationInterface.publishSolution(solution)) {
			System.err.println("Solution is feasible");
		} else {
			System.err.println("Solution is not feasible");
		}
	}

}
